package com.frxuexi.lib_base.http

import com.frxuexi.lib_base.entity.CartBean
import com.frxuexi.lib_base.entity.CreateOrderRespBean
import com.frxuexi.lib_base.entity.LoadPreOrderBean
import com.frxuexi.lib_base.entity.OrderBean
import com.frxuexi.lib_base.entity.PayOrderBean
import com.frxuexi.lib_base.entity.PreOrderResBean
import com.frxuexi.lib_base.entity.ReplyBean
import com.frxuexi.lib_base.entity.ReplyBeanItem
import com.frxuexi.lib_base.entity.Res
import com.frxuexi.lib_base.entity.ShopBean
import com.frxuexi.lib_base.entity.ShopBeanItem
import com.frxuexi.lib_base.entity.ShopDetailBean
import com.frxuexi.lib_base.entity.ShopHomeBean
import kotlinx.coroutines.flow.Flow
import okhttp3.RequestBody
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.POST
import retrofit2.http.Path
import retrofit2.http.Query

interface ShopApiService {

    @GET("/api/front/index")
    fun getHomeBean():Flow<Res<ShopHomeBean>>

    @GET("/api/front/index/product/{type}")
    fun getShops(@Path("type")type:Int,@Query("page")page:Int,@Query("limit")limit:Int):Flow<Res<ShopBean>>

    @GET("/api/front/product/detail/{id}")
    fun getShopById(@Path("id")id:Int,@Query("type")type:String):Flow<Res<ShopDetailBean>>

    @POST("/api/front/cart/save")
    fun addCart(@Body body: RequestBody):Flow<Res<Any>>

    @GET("/api/front/cart/list?limit=10&isValid=true")
    fun getCarts(@Query("page")page:String):Flow<Res<CartBean>>

    @POST("/api/front/cart/num")
    fun updateCart(@Query("id")id:Int,@Query("number")number:Int):Flow<Res<String>>

    @POST("/api/front/order/pre/order")
    fun preOrder(@Body body: RequestBody):Flow<Res<PreOrderResBean>>

    @GET("/api/front/order/load/pre/{preOrderNo}")
    fun getPreOrder(@Path("preOrderNo")preOrderNo:String):Flow<Res<LoadPreOrderBean>>

    @POST("/api/front/order/create")
    fun createOrder(@Body body: RequestBody):Flow<Res<CreateOrderRespBean>>

    @GET("/api/front/order/list")
    fun getMyOrder(@Query("type")type:String,@Query("limit")limit:Int,@Query("page")page:Int):Flow<Res<OrderBean>>

    //支付
    @POST("/api/front/pay/payment")
    fun payOrder(@Body body: RequestBody):Flow<Res<PayOrderBean>>


    @GET("/api/front/reply/list/{id}")
    fun getRepalys(@Path("id")id:Int,@Query("limit")limit:Int,@Query("page")page:Int,@Query("type")type:String):Flow<Res<ReplyBean>>

}